var xmlhttp = null;
if (window.XMLHttpRequest) {
	try {
		// Firefox, Opera 8.0+, Safari
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
}
function init() {
	window.setInterval("queryMessageAPP()", 10000);
}

function queryMessageAPP() {
	xmlhttp.open("post", "login!messageUnread.action", false);
	xmlhttp.onreadystatechange = updatePage;
	xmlhttp.send();
}

function updatePage() {
	var unRead = document.getElementById("unRead");
	if (xmlhttp.readyState < 4) {
		unRead.innerHTML = "0";
	}
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		var response = xmlhttp.responseText;
		if (response != 0) {
			unRead.innerHTML = response;
		} else {
			unRead.innerHTML = "0";
		}
	}
}
